package com.commonlover.controller;

import com.alibaba.fastjson.JSONObject;
import com.commonlover.result.WebResult;
import com.commonlover.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import static com.commonlover.result.WebResult.REQUEST_STATUS_SUCCESS;

@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;

    @PutMapping("findUserDetailById")
    public WebResult<JSONObject> findUserDetailById(@RequestParam Integer id) {
        return WebResult.<JSONObject>builder()
                .code(200)
                .message(REQUEST_STATUS_SUCCESS)
                .data(userService.findUserDetailById(id))
                .build();
    }
}
